# -*- coding: utf-8 -*-
"""谁都可能用的小工具，放这里，不依赖任何业务模块"""
import ctypes
from ctypes import wintypes

def get_idle_seconds():
    """系统空闲秒数"""
    class LASTINPUTINFO(ctypes.Structure):
        _fields_ = [('cbSize', wintypes.UINT), ('dwTime', wintypes.DWORD)]
    lii = LASTINPUTINFO()
    lii.cbSize = ctypes.sizeof(LASTINPUTINFO)
    ctypes.windll.user32.GetLastInputInfo(ctypes.byref(lii))
    return (ctypes.windll.kernel32.GetTickCount() - lii.dwTime) / 1000.0